home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 4 / CDPD_IV.bin / e / mailinglists / amigae.0793july.archive / 000103_crash!kirk.safb.af.mil!BWILLS_Thu, 29 Jul 93 07:44:44 PST.msg < prev    next >
Internet Message Format  |  1994-05-26  |  2KB

  1. Received: by bkhouse.cts.com (V1.16/Amiga)
  2.     id AA00000; Thu, 29 Jul 93 07:44:44 PST
  3. Received: from kirk.safb.af.mil by crash.cts.com with smtp
  4.     (Smail3.1.28.1 #15) id m0oLYtL-0000SqC; Thu, 29 Jul 93 07:23 PDT
  5. Message-Id: <m0oLYtL-0000SqC@crash.cts.com>
  6. Date: 29 Jul 93 09:21:00 CST
  7. From: "Barry D. Wills" <BWILLS@kirk.safb.af.mil>
  8. To: "amigae" <amigae@bkhouse.cts.com>
  9. Subject: MidStr
  10.  
  11. Hi, Jeffrey.  In response to your message:
  12.  
  13. >    I can't get MidStr() to work right.  It is reading it from the starting
  14. >point right, but I can't get it to stop! I am trying to get a version string
  15. >pulled out of a buffer I am getting from Read(). Before vtst was defined as a
  16. >string, it was working somewhat well (I was getting what I wanted), but I am
  17. >not sure whether it was stoping where I wanted. What I need is the original
  18. >version string, with the revision number bumped up by one.
  19.  
  20. =======================================================================
  21.  
  22. PROC findver(pos) /* pos is found in the prior proc */
  23.   DEF endpos,
  24.       vers,
  25.       per,
  26.       vn,
  27.       vp,
  28.       vns,
  29.       nvers,
  30.       rvers,
  31.       vtst[80]:STRING
  32.  
  33.   endpos:=InStr(filbuf,'\n',pos) /* finding then end of the line */
  34. *******************************************************************************
  35. *** Your problem starts here.  vers is uninitialized, so it contains a value
  36. *** that looks like an address.  MidStr() copies characters to the nonexistent
  37. *** string at "address" vers.  You need to declare these as STRING or allocate
  38. *** the using String().   Basically, this is copying characters into random 
  39. *** memory locations, a very effective way to corrupt your memory :(  I noticed
  40. *** this happening in several places in the code that follows this statement. 
  41. ***
  42.   MidStr(vers,filbuf,pos,endpos-pos)
  43.  
  44. [statements removed]
  45.  
  46. *** StringF() still might work under lucky circumstances.
  47.   StringF(vtst,'\s \d.\d',nvers,vp,rvers)
  48.  
  49. *** As for your run-on problem, it may be a symptom of this.  If it persists
  50. *** then post, post again!  :-)
  51.  
  52.  
  53. Later.
  54. -- Barry